-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(backend)!: Add backend to config and use rustic_backend
#977
Conversation
@@ -63,6 +64,7 @@ log = { workspace = true } | |||
# serialization | |||
serde = { workspace = true } | |||
serde_json = { workspace = true } | |||
serde_path_to_error = { workspace = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Nice, but didn't really get it to work, could be nice for user facing errors though regarding misconfiguration.
@@ -115,6 +122,8 @@ anyhow = "1" | |||
serde = { version = "1", features = ["serde_derive"] } | |||
serde_with = { version = "3.4", features = ["base64"] } | |||
serde_json = "1" | |||
serde_path_to_error = "0.1.14" | |||
toml_edit = { version = "0.21.0", features = ["serde"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: remove, we have toml
and toml_edit
here, we only need the high-level crate (toml) for what we currently do.
69e1941
to
199b6f0
Compare
Signed-off-by: simonsan <[email protected]> refactor: commands now use the new backend struct from rustic_backend Signed-off-by: simonsan <[email protected]> refactor: change config files and implement test to parse all config files with new settings for rustic_backend Signed-off-by: simonsan <[email protected]> fix: typo Signed-off-by: simonsan <[email protected]> style: dprint fmt Signed-off-by: simonsan <[email protected]> testing: use result Signed-off-by: simonsan <[email protected]>
199b6f0
to
1683847
Compare
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
config/copy_example.toml
Outdated
[[copy]] | ||
# Second copy target | ||
[copy.options] | ||
password-file = "/root/key-rustic-ovh" | ||
cache-dir = "/var/lib/cache/rustic" # explicitly specify cache dir for remote repository | ||
|
||
[copy.backend] | ||
repository = "rclone|ovh:backup" | ||
repo-hot = "rclone|ovh:backup-hot" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aawsome I think the naming is a bit off now, so we need to check what is best.
copy.options
is essentially copy.repository.options
.
Also it may be confusing to have [[copy]]
twice, which is the right thing IMHO, because it is an array of backends in the ends, but maybe we can find a different approach, now that we may need to have a breaking change in the config?
config/full.toml
Outdated
# Repository options: These options define which backend to use and which password to use. | ||
[repository] | ||
# Backend options: These options define which backend to use. | ||
[backend] | ||
repository = "/repo/rustic" # Must be set | ||
repo-hot = "/my/hot/repo" # Default: not set | ||
# one of the three password options must be set | ||
|
||
# Additional backend options - depending on backend. These can be only set in the config file. | ||
[backend.options] | ||
post-create-command = "par2create -qq -n1 -r5 %file" # Only local backend; Default: not set | ||
post-delete-command = "sh -c \"rm -f %file*.par2\"" # Only local backend; Default: not set | ||
retry = "default" # Only rest/rclone backend; Allowed values: "false"/"off", "default" or number of retries | ||
timeout = "10min" # Only rest/rclone backend | ||
|
||
# Repository options: These options define which repository settings and passwords to use. | ||
[repository] | ||
# Optional, but one of the three password options must be set | ||
# either on CLI, in the config file or in environment variables | ||
password = "mySecretPassword" | ||
password-file = "/my/password.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't really like the differentiation now:
[backend]
repository = ""
repo-hot = ""
[backend.options]
[repository]
Maybe we find some better naming there which makes it more clear?
Signed-off-by: simonsan <[email protected]>
config/simple.toml
Outdated
# Backend options: These options define which backend to use. | ||
[backend] | ||
repository = "/tmp/repo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Backend options: These options define which backend to use. | |
[backend] | |
repository = "/tmp/repo" | |
# Storage options: These options define which backend to use. | |
[storage] | |
provider = local | |
path = "/tmp/repo" |
@aawsome I would close this, and we can talk about this approach, now that we have profile inheritance there might be better ways to deal with this? In any case, we can use this as a foundation. |
BREAKING CHANGE:
TODO:
copy
in a good way